/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.opgea.appstreet.domain.entities;

import com.opgea.appstreet.domain.model.RequirementStatus;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Ramesh
 */
@Entity
@Table(name = "requirement")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Requirement.findAll", query = "SELECT r FROM Requirement r"),
    @NamedQuery(name = "Requirement.findById", query = "SELECT r FROM Requirement r WHERE r.id = :id"),
    @NamedQuery(name = "Requirement.findByGeneratedDate", query = "SELECT r FROM Requirement r WHERE r.generatedDate = :generatedDate"),
    @NamedQuery(name = "Requirement.findByStatus", query = "SELECT r FROM Requirement r WHERE r.status = :status")})
public class Requirement implements Serializable {
    
    @Id
    @GeneratedValue
    private Long id;
    private byte[] details;
    @ManyToOne
    private Category category;
    @ManyToOne
    private SubCategory subCategory;
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    private Date generatedDate;
    private RequirementStatus status;
    @ManyToOne
    private Customer customer;

    public Requirement() {
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public byte[] getDetails() {
        return details;
    }

    public void setDetails(byte[] details) {
        this.details = details;
    }

    public Date getGeneratedDate() {
        return generatedDate;
    }

    public void setGeneratedDate(Date generatedDate) {
        this.generatedDate = generatedDate;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public RequirementStatus getStatus() {
        return status;
    }

    public void setStatus(RequirementStatus status) {
        this.status = status;
    }

    public SubCategory getSubCategory() {
        return subCategory;
    }

    public void setSubCategory(SubCategory subCategory) {
        this.subCategory = subCategory;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Requirement other = (Requirement) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 67 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "Requirement{" + "id=" + id + ", details=" + details + ", category=" + category + ", subCategory=" + subCategory + ", generatedDate=" + generatedDate + ", status=" + status + ", customer=" + customer + '}';
    }
    
}
